<?php
// 预准备查询
header("Content-type:text/html;charset=utf-8");
$mysqli = new mysqli("localhost", "root", "admin888", "c50");
$mysqli->query("set names utf8");
if ($stmt = $mysqli->prepare("SELECT id,sname FROM stu WHERE id=?")) {
    //3 or id>0
    $id=$_GET['id'];
    /* 绑定参数 */
    $stmt->bind_param("s", $id);
    /* 执行查询 */
    $status=$stmt->execute();
    /* 绑定结果集 */
    $stmt->bind_result($id,$sname);
    /* 读取数据 */
    while($stmt->fetch()){
        printf("ID是: %s, SNAME: %s<br/>", $id, $sname);
    }
}